package com.yx.musicplayer.greendao.gen;

import android.database.sqlite.SQLiteDatabase;

import com.yx.baselibrary.base.BaseLibraryApplication;

/**
 * @ClassName DaoManager
 * @Description 数据操作类
 * Created by yx on 2017/10/31 0031.
 */

public class DaoManager {
    private DaoMaster.DevOpenHelper mHelper;
    private SQLiteDatabase db;
    private DaoMaster mDaoMaster;
    private DaoSession mDaoSession;
    private  static DaoManager mInstance ;

    public static   DaoManager  getInstance(){
       if(mInstance ==null){
           mInstance =new DaoManager();
       }
       return mInstance;
    }

    private DaoManager() {
        DaoMaster.DevOpenHelper devOpenHelper = new DaoMaster.DevOpenHelper(BaseLibraryApplication.getAppContext(), "music-db", null);
        DaoMaster mDaoMaster = new DaoMaster(devOpenHelper.getWritableDatabase());
        mDaoSession = mDaoMaster.newSession();
    }


    public DaoSession getDaoSession() {
        return mDaoSession;
    }
    public SQLiteDatabase getDb() {
        return db;
    }

}


